<template>
  <div class="historical_det">
    <navigate>历史活动详情</navigate>
    <div class="det_cont">
      <!-- tab切换 -->
      <div class="tab_list dis_flex white_box">
        <div class="item_tab" v-for="(item, index) in tabArr" :key="index" @click="chooseTab(index)"
          :class="currentTab == index ? 'active_tab' : ''">
          {{ item }}
        </div>
      </div>

      <activityBasicInfo :activityInfo="activityInfo" v-if="currentTab == 0" />
      <mattersExplanation :activityInfo="activityInfo" v-if="currentTab == 1" />
      <userFeedback :id="activityInfo.id" :taskId="activityInfo.task_id" v-if="currentTab == 2" />
    </div>
  </div>
</template>

<script>
import activityBasicInfo from "./components/activityBasicInfo.vue";
import mattersExplanation from "./components/mattersExplanation.vue";
import userFeedback from "./components/userFeedback.vue";
import { queryHistoryDetails } from "@/api/funcation/groupActivity";
export default {
  data() {
    return {
      tabArr: ["活动基本情况", "活动详细内容", "用户评论反馈"],
      currentTab: 0,
      id: '',
      activityInfo: {}
    };
  },
  created() {
    this.id = this.$route.query.id
    this.getHistoryDetails()
  },
  components: { userFeedback, activityBasicInfo, mattersExplanation },
  methods: {
    chooseTab(v) {
      this.currentTab = v;
    },
    async getHistoryDetails() {
      let data = await queryHistoryDetails({ id: this.id })
      if (data.code == 200) {
        this.activityInfo = data.data
      }
    }
  },
};
</script>

<style lang="less" scoped>
.dis_flex {
  display: flex;
  align-items: center;
}

.just_center {
  justify-content: center;
}

.white_box {
  background: #ffffff;
  border-radius: 6.67px;
}

.historical_det {
  background-color: #f4f6fa;
  color: #333333;
  font-size: 14px;
}

.det_cont {
  // padding: 10px 10px 0 10px;
}

//tab
.tab_list {
  height: 46.67px;
  line-height: 40px;
  margin-bottom: 10px;
  margin: 10px 10px 0 10px;
}

.item_tab {
  flex: 1;
  height: 40px;
  text-align: center;
  font-weight: bold;
  font-size: 14.67px;
}

.active_tab {
  border-radius: 6.67px;
  color: #ffffff;
  background: linear-gradient(0deg, #ffffff -20%, rgba(255, 255, 255, 0) 20%),
    #00aeff;
}
</style>
